Page({
  /**
   * 页面的初始数据
   */
  data: {
    inputLen: 9,//输入框个数
    iptValue: "",
    isFocus: false,
    classCid:[],
  },

  onFocus: function (e) {
    var that = this;
    that.setData({ isFocus: true });
  },
  setValue: function (e) {
    var that = this;
    that.setData({ iptValue: e.detail.value });
  },
  examine(e){
    let that = this
    wx.request({
      url: 'http://101.43.154.9:8001/class',
      method:'GET',
      success:(res)=>{
        that.setData({
          classCid:res.data
        })
        console.log(typeof(that.data.classCid[12].cid))
        console.log(typeof(that.data.iptValue))
        for(var i = 0;i<that.data.classCid.length-1;i++){
          if(Number(that.data.iptValue)===Number(that.data.classCid[i].cid)){
            wx.request({
              url: 'http://101.43.154.9:8001/joinclass',
              method:'POST',
              data:{
                sid:123,
                scid:that.data.classCid[i].cid
              },
              success:(res)=>{
                console.log(res)
              }
            })
          }
        }
      }
    })
  }
})